﻿using System.Text;
using Newtonsoft.Json;

namespace ZooKeeperManage
{
    public class SerializeJson : ISerialize
    {
        public byte[] Serializer<T>(T serialObject) where T : class
        {
            return Encoding.UTF8.GetBytes(JsonConvert.SerializeObject(serialObject));
        }

        public T Deserialize<T>(byte[] content) where T : class
        {
            string json = Encoding.UTF8.GetString(content);
            return JsonConvert.DeserializeObject<T>(json);
        }
    }
}
